var ns;
var app = new Vue({
    el: '#app',
    data: {
        chatlist:[]

    },
    methods: {
        getdata:function(){
            var that=this;
            ns.post({
                action: 'getmyblacklist',
            }, function(succeed, data, err) {
                if (succeed) {
                    that.chatlist=data.chatlist;
                } else if (err) {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            });
           
        },
        //取消拉黑
        quxiao_black:function(id){
            var that=this;
            api.confirm({
                title: '提示',
                msg: '是否将该用户从【黑名单】中进行移除？',
                buttons: ['确认移除', '取消操作']
            }, function (ret, err) {
                if (ret) {
                    if (ret.buttonIndex == 1) {
                        ns.post({
                            ID:id,
                            action: 'deleteblack',
                        }, function(succeed, data, err) {
                            if (succeed) {
                                api.toast({
                                    msg: '成功移除',
                                    duration: 2000,
                                    location: 'bottom'
                                });
                                api.sendEvent({
                                    name: 'do_update_tiezi'
                                });
                                setTimeout(function() {
                                    that.getdata();
                                }, 300);
                            } else if (err) {
                                api.toast({
                                    msg: err,
                                    duration: 2000,
                                    location: 'bottom'
                                });
                            }
                        })
                    };
                };
            });
            
        }

    }
});

apiready = function() {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.getdata();


}
